using Lily.Example.Forms.Models;
using NUnit.Framework;

namespace Lily.Example.Tests
{
	[TestFixture]
	public class FormsTests : UiTestBase
	{
		[Test]
		public void Should_Change_Button_Label_()
		{
			var buttonName = "btnClick1";

			Window.ClickButton(buttonName);

			var buttonVal = Window.GetValue(buttonName);
			Assert.AreEqual("Hello World!!", buttonVal);
		}

		[Test]
		public void Should_fill_form_textbox()
		{
			Form<HelloWorldFormInput>("White Hello World")
				.Input(x => x.PersonName, "Bart Simpson")
				.Save();
			Assert.AreEqual("Bart Simpson", Window.GetValue("PersonName"));

		}

		[Test]
		public void Should_select_checkbox()
		{
			Form<HelloWorldFormInput>("White Hello World")
				.Input(x => x.Vanilla, true)
				.Input(x => x.Chocolate, false)
				.Save();
			Assert.AreEqual(true.ToString(), Window.GetValue("Vanilla"));
			Assert.AreEqual(false.ToString(), Window.GetValue("Chocolate"));
		}

		[Test]
		public void Should_change_spinner()
		{
			Form<HelloWorldFormInput>("White Hello World")
				.Input(x => x.FavoriteNumber, "3")
				.Save();
			Assert.AreEqual("3", Window.GetValue("FavoriteNumber"));
		}

		[Test]
		public void Should_select_combobox_item()
		{
			Form<HelloWorldFormInput>("White Hello World")
				.Input(x => x.WeekDay, "Tuesday")
				.Save();
			Assert.AreEqual("Tuesday", Window.GetValue("WeekDay") );
		}
	}
}